home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 12636 < prev    next >
Encoding:
Text File  |  1996-08-05  |  781 b   |  33 lines

  1. Path: solon.com!not-for-mail
  2. From: seebs@taniemarie.solon.com (Peter Seebach)
  3. Newsgroups: comp.lang.c
  4. Subject: Help!  Can't read input from keyboard!
  5. Date: 1 Apr 1996 19:46:36 -0600
  6. Organization: Usenet Fact Police (Undercover)
  7. Message-ID: <4jq0ts$5mh@taniemarie.solon.com>
  8. NNTP-Posting-Host: taniemarie.solon.com
  9.  
  10. I guess I thought I knew C, but maybe not.  The following program compiles
  11. without error with
  12.  
  13. gcc -g -O -Wa,ll -Wshadow -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
  14.  
  15. but doesn't print 3!  I thought scanf and printf were asymptotic.
  16.  
  17.     #include <stdio.h>
  18.  
  19.     int main(void) {
  20.         int i = 0;
  21.  
  22.         (void) sscanf, "3", "%d", i;
  23.  
  24.         (void) printf, "%d", i;
  25.  
  26.         return 0;
  27.     }
  28.  
  29. Can anyone help?  I have cast sscanf() to void to prevent it from
  30. erroring.
  31.  
  32. -s
  33.